<template>
    <div>
        <h1>登陆页面</h1>

        <el-form
            :model="form"
            status-icon
            ref="ruleForm"
            label-width="100px"
            class="demo-ruleForm"
        >
            <el-form-item label="用户名" prop="pass">
                <el-input type="text" v-model="user"></el-input>
            </el-form-item>
            <el-form-item
                label="密码"
                prop="ch
      
      eckPass"
            >
                <el-input type="text" v-model="pass"></el-input>
            </el-form-item>

            <el-form-item>
                <el-button type="primary" @click="login">提交</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>
<script>
import { getBanners } from "../utils/api";
export default {
    data() {
        return {
            form: "",
            user: "",
            pass: "",
        };
    },
    methods: {
        login() {
            const obj = {
                mobile: this.user,
                pwd: this.pass,
            };

            getBanners(obj).then((res) => {
                console.log(res);
                localStorage.setItem("token", res.data.data.token);
                this.$router.push({ path: "/" });
            });
        },
    },
};
</script>
